import request from '@/utils/request';

export async function getPickingDetailsByPage(params: any) {
  return request('/api/product/getPickingDetailsByPage', {
    method: 'POST',
    data: params,
  });
}

export async function addPickingDetails(params: any) {
  return request('/api/product/addPickingDetails', {
    method: 'POST',
    data: params,
  });
}

export async function updatePickingDetails(params: any) {
  return request('/api/product/updatePickingDetails', {
    method: 'POST',
    data: params,
  });
}

export async function delPickingDetails(params: any) {
  return request('/api/product/delPickingDetails', {
    method: 'POST',
    data: params,
  });
}

export async function exportPickingDetails(params: any) {
  return request('/api/product/exportPickingDetails', {
    method: 'POST',
    data: params,
    responseType: 'blob',
  });
}

//扫描/api/product/addMaterialQty
export async function addMaterialQty(params: any) {
  return request('/api/product/addMaterialQty', {
    method: 'POST',
    params: {
      materialCode: params.materialCode,
      pickingTaskCode: params.pickingTaskCode,
    },
  });
}
//模糊匹配/api/product/getPickingDetailsByPageLike
export async function getPickingDetailsByPageLike2(data: any, params: any) {
  return request('/api/product/getPickingDetailsByPageLike2', {
    method: 'POST',
    data: params,
    params: {
      like: data.like,
      pickingTaskCode: data.pickingTaskCode,
    },
  });
}

//根据批次计划获取分料细节信息
export async function getPickingDetailsByBatchPlanId(params: any) {
  return request('/api/product/getPickingDetailsByBatchPlanId',{
    method:'POST',
    params:{
      id: params,
    }
  })
}

export default {
  getPickingDetailsByPage,
  addPickingDetails,
  updatePickingDetails,
  delPickingDetails,
  exportPickingDetails,
};
